from openai import OpenAI
    
client = OpenAI(
  api_key="xai-jRjoda60e5u3yKuXThADn2ciyQUN0QhYnTJikgwsegDMmjM5hGAlRElWzeJEVlOz3hPFboqy0AsoPp2Y",
  base_url="https://api.x.ai/v1",
)

completion = client.chat.completions.create(
  model="grok-4",
  messages=[
    {"role": "system", "content": "使用中文回答问题。"},
    {"role": "user", "content": "生命、宇宙和一切的意义是什么？"}
  ]
)

# main方法,调用并打印结果
if __name__ == "__main__":
    print(completion.choices[0].message.content)
    print("#完成请求")

